package com.easyadmin.modules.stock.controller;


import com.easyadmin.common.web.base.BaseController;
import com.easyadmin.common.web.domain.request.PageDomain;
import com.easyadmin.common.web.domain.response.Result;
import com.easyadmin.common.web.domain.response.module.ResultTable;
import com.easyadmin.modules.stock.domain.SysEtfDayPriceEntity;
import com.easyadmin.modules.stock.domain.SysStockEntity;
import com.easyadmin.modules.stock.service.SysEtfDayPriceServer;
import com.easyadmin.modules.stock.service.SysStockServer;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

/**
 * etf表
 *
 * @author wanzenghui
 * @email lemon_wan@aliyun.com
 * @date 2025-04-03 20:54:57
 */
@RestController
@RequestMapping("/stock/etfd")
public class SysEtfDayPriceController extends BaseController {


    /**
     * Describe: 基础路径
     */
    private static String MODULE_PATH = "stock/etfd/";

    /**
     * Describe: 获取角色列表视图
     * Param ModelAndView
     * Return 用户列表视图
     */
    @GetMapping("main")
    @ApiOperation(value = "获取列表视图")
    @PreAuthorize("hasPermission('/stock/etfd/main','stock:etfd:main')")
    public ModelAndView main() {
        return jumpPage(MODULE_PATH + "main");
    }



    @Autowired
    private SysEtfDayPriceServer sysEtfDayPriceServer;

    /**
     * 分页查询
     */
    @ResponseBody
    @GetMapping("/list")
    @PreAuthorize("hasPermission('/stock/etfd/list','stock:etfd:list')")
    public ResultTable list(@ModelAttribute SysEtfDayPriceEntity sysEtfDayPriceEntity, PageDomain pageDomain) {
        PageInfo<SysEtfDayPriceEntity> pageInfo = sysEtfDayPriceServer.queryPage(sysEtfDayPriceEntity, pageDomain);
        return pageTable(pageInfo.getList(), pageInfo.getTotal());
    }


    /**
     * Describe: 同步产品年纪
     * Param SysRole
     * Return 执行结果
     */
    @DeleteMapping("synchetfd/{ids}")
    @ApiOperation(value = "修改数据")
    @PreAuthorize("hasPermission('/stock/etfd/synchetfd','stock:etfd:synchetfd')")
    public Result synchetfd(@PathVariable String ids) {
        return decide(sysEtfDayPriceServer.synchetfd(ids));
    }


    /**
     * Describe: 同步产品年纪
     * Param SysRole
     * Return 执行结果
     */
    @DeleteMapping("synch/{ids}")
    @ApiOperation(value = "修改数据")
    @PreAuthorize("hasPermission('/stock/etfd/synch','stock:etfd:synch')")
    public Result synch(@PathVariable String ids) {
        return decide(sysEtfDayPriceServer.synch(ids));
    }


}
